﻿using System.Collections;
using System.Collections.Generic;

namespace Soul.XLS
{
    public class ExcelRowCollection : ICollection<ExcelRow>
    {
        private ICollection<ExcelRow> _items;

        public ExcelRowCollection()
        {
            _items = new List<ExcelRow>();
        }
        
        public int Count => _items.Count;

        public bool IsReadOnly => _items.IsReadOnly;

        public void Add(ExcelRow item)
        {
            _items.Add(item);
        }

        public void Clear()
        {
            _items.Clear();
        }

        public bool Contains(ExcelRow item)
        {
            return _items.Contains(item);
        }

        public void CopyTo(ExcelRow[] array, int arrayIndex)
        {
            _items.CopyTo(array, arrayIndex);
        }

        public IEnumerator<ExcelRow> GetEnumerator()
        {
            return _items.GetEnumerator();
        }

        public bool Remove(ExcelRow item)
        {
            return _items.Remove(item);
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return ((IEnumerable)_items).GetEnumerator();
        }
    }
}
